package com.taldh.design.patterns.factories.abstractfacotories.impl;

/**
 * date: 2020/5/24
 *
 * @author 袁小黑
 * @version 1.0.0
 */

public class App {

    public static void main(String[] args) {
        InsuranceFactoryMaker insuranceFactoryMaker = new InsuranceFactoryMaker();
        //随机出保单
        for (int i = 0; i < 10; i++) {
            InsuranceCompany insuranceCompany = InsuranceCompany.values()[Math.random() > 0.5 ? 0 : 1];
            InsuranceFactory insuranceFactory = insuranceFactoryMaker.getInsuranceFactory(insuranceCompany);
            insuranceFactory.createAccidentInsurance().insurance();
            insuranceFactory.createJunenileInsurance().insurance();
            insuranceFactory.createLifeInsurance().insurance();
        }
    }

}
